package com.xpjhs.menu.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xpjhs.menu.model.Menu;
import com.xpjhs.menu.service.MenuService;

@Controller
@RequestMapping("/menu")
public class MenuController {

	@Autowired
	private MenuService menuService;
	@RequestMapping("/save")
	public String saveMenu(HttpServletRequest request,ModelMap model){
		Menu menu=new Menu();
		menu.setTitle("首页");
		menu.setDescription("就是个首页");
		menu.setIconUrl("/images/shouye.jpg");
		menu.setDivider(true);
		menu.setLevel(1);
		menu.setMainMenu(true);
		menu.setOrderNumber(1);
		menu.setParent(null);
		menu.setPermission("编辑");
		menu.setUrl("/login");
		menuService.saveMenu(menu);
		System.out.println("保存菜单");
		return null;
	}
}
